package com.ebring.shareEducation.controller;



import com.ebring.shareEducation.bean.Task;
import com.ebring.shareEducation.service.TaskService;
import com.ebring.shareEducation.utils.RspMsg;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TaskController {

    @Autowired
    private TaskService taskService;

    /**
     * 查询所有任务列表
     *
     * @return
     */
    @GetMapping("/task/list")
    public RspMsg<Task> select() {
        return taskService.selectTask();
    }

    /**
     * 修改任务
     */
       @PostMapping("/task/update")
    public RspMsg<Task> updateTask(Task task) {
           return taskService.updateTask(task);
    }




    /**
     * 根据任务ID删除任务
     *
     * @param taskId 菜单id
     * @return
     */

    @PostMapping("/task/deleteById")
    public RspMsg<Task> deleteById(String taskId) {
        return taskService.deleteById(taskId);
    }

    /**
     * 新增任务
     *
     * @param task 菜单对象
     * @return
     */

    @PostMapping("/task/insertMenu")
    public RspMsg<Task> insertTask(Task task) {
        return taskService.insertTask(task);
    }



    /**
     * 查询用户下面的任务
     *
     * @param taskId
     * @return
     */
    @PostMapping("/task/select")
    public RspMsg<Task> selectTask(String taskId){
        return taskService.selectUTask(taskId);
    }




}
